
# # node 构建
# FROM node:20-alpine as build-stage
# # 署名
# MAINTAINER xiehanbing 'xiebbing@126.com'
# WORKDIR /app
# COPY . ./
# # 设置 node 阿里镜像
# RUN npm config set registry https://registry.npmmirror.com
# # 设置--max-old-space-size
# ENV NODE_OPTIONS=--max-old-space-size=16384
# # 设置阿里镜像、pnpm、依赖、编译
# # RUN npm install pnpm -g && \
# #     pnpm build
# RUN npm install && \
# 	# npm install -g @vue/cli && \
#      npm run  build
# # node部分结束
# RUN echo "🎉 编 🎉 译 🎉 成 🎉 功 🎉"
# # nginx 部署
# FROM nginx:1.23.3-alpine as production-stage
# COPY --from=build-stage /app/dist /usr/share/nginx/html/dist
# COPY --from=build-stage /app/nginx.conf /etc/nginx/nginx.conf
# EXPOSE 80
# ## 将/usr/share/nginx/html/dist/assets/index.js 和/usr/share/nginx/html/dist/_app.config.js中的"$vg_base_url"替换为环境变量中的VG_BASE_URL,$vg_sub_domain 替换成VG_SUB_DOMAIN，$vg_default_user替换成VG_DEFAULT_USER，$vg_default_password替换成VG_DEFAULT_PASSWORD 而后启动nginx
# CMD sed -i "s|API_URL|$VUE_APP_API_BASEURL|g" /usr/share/nginx/html/dist/assets/entry/index-*.js /usr/share/nginx/html/dist/config.js && \
#     nginx -g 'daemon off;'
# RUN echo "🎉 架 🎉 设 🎉 成 🎉 功 🎉"







#node 构建
#FROM registry.cn-hangzhou.aliyuncs.com/xhbimage/node:v14.17.6 as build
#WORKDIR /app
#COPY . ./
#RUN cnpm install
#RUN cnpm run build
#WORKDIR /app
#RUN echo 'app 文件夹下目录'
#RUN ls
#WORKDIR /app/dist
#RUN echo 'dist 文件夹下目录'
#RUN ls
#nginx 发布
FROM nginx
WORKDIR /app
# COPY . .
# RUN mkdir -p /usr/share/nginx/html/dist
 COPY  dist /usr/share/nginx/html/dist
 COPY  nginx.conf /etc/nginx/nginx.conf
#COPY dist/ /usr/share/nginx/html/dist/
COPY nginx.conf /etc/nginx/nginx.conf
COPY default.conf /etc/nginx/conf.d
RUN echo "参数：$VUE_APP_API_BASEURL"
## 将/usr/share/nginx/html/dist/assets/index.js 和/usr/share/nginx/html/dist/_app.config.js中的"$vg_base_url"替换为环境变量中的VG_BASE_URL,$vg_sub_domain 替换成VG_SUB_DOMAIN，$vg_default_user替换成VG_DEFAULT_USER，$vg_default_password替换成VG_DEFAULT_PASSWORD 而后启动nginx
# CMD sed -i "s|VUE_APP_API_BASEURL|$VUE_APP_API_BASEURL|g"  /usr/share/nginx/html/dist/config.js && \
#     nginx -g 'daemon off;'
#RUN ls -la /usr/share/nginx/html/dist/*
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' > /etc/timezone
EXPOSE 80
RUN echo "🎉 架 🎉 设 🎉 成 🎉 功 🎉"
